using System;
using System.Collections.Generic;
using System.Text;
using NHibernate;
using NHibernate.Criterion;

using QLTDK.Entities;
using QLTDK.DataAccess.Interfaces.BaseInterfaces;
using QLTDK.DataAccess.Base;

namespace QLTDK.DataAccess.BaseDaos
{
    public class BaseTdkTudieukhienDao : NHibernateDao<TdkTudieukhien, int>, IBaseTdkTudieukhienDao
    {
		#region Constructors
		
		public BaseTdkTudieukhienDao() : base()
        {
        }
		
		#endregion
		
        #region Get Methods

		
		public IList<TdkTudieukhien> GetByMaCongTrinhLapDat(System.Int32 maCongTrinhLapDat)
        {
			return HibernateTemplate.ExecuteFind<TdkTudieukhien>(

			    delegate(ISession session)
				{
					ICriteria criteria = session.CreateCriteria(typeof(TdkTudieukhien));
					
					
					ICriteria maCongTrinhLapDatCriteria = criteria.CreateCriteria("MaCongTrinhLapDat");
					maCongTrinhLapDatCriteria.Add(Expression.Eq("Id", maCongTrinhLapDat));
					
					return criteria.List<TdkTudieukhien>();
				});
        }
		
		public IList<TdkTudieukhien> GetByMaLoaiDienKe(System.Int32 maLoaiDienKe)
        {
			return HibernateTemplate.ExecuteFind<TdkTudieukhien>(

			    delegate(ISession session)
				{
					ICriteria criteria = session.CreateCriteria(typeof(TdkTudieukhien));
					
					
					ICriteria maLoaiDienKeCriteria = criteria.CreateCriteria("MaLoaiDienKe");
					maLoaiDienKeCriteria.Add(Expression.Eq("Id", maLoaiDienKe));
					
					return criteria.List<TdkTudieukhien>();
				});
        }
		
		public IList<TdkTudieukhien> GetByMaLoaiHopPhanPhoi(System.Int32 maLoaiHopPhanPhoi)
        {
			return HibernateTemplate.ExecuteFind<TdkTudieukhien>(

			    delegate(ISession session)
				{
					ICriteria criteria = session.CreateCriteria(typeof(TdkTudieukhien));
					
					
					ICriteria maLoaiHopPhanPhoiCriteria = criteria.CreateCriteria("MaLoaiHopPhanPhoi");
					maLoaiHopPhanPhoiCriteria.Add(Expression.Eq("Id", maLoaiHopPhanPhoi));
					
					return criteria.List<TdkTudieukhien>();
				});
        }
		
		public IList<TdkTudieukhien> GetByMaLoaiTDK(System.Int32 maLoaiTDK)
        {
			return HibernateTemplate.ExecuteFind<TdkTudieukhien>(

			    delegate(ISession session)
				{
					ICriteria criteria = session.CreateCriteria(typeof(TdkTudieukhien));
					
					
					ICriteria maLoaiTDKCriteria = criteria.CreateCriteria("MaLoaiTDK");
					maLoaiTDKCriteria.Add(Expression.Eq("Id", maLoaiTDK));
					
					return criteria.List<TdkTudieukhien>();
				});
        }
		
		#endregion
    }
}